const KoaRouter = require('@koa/router')
const settingRouter = new KoaRouter({ prefix: '/setting' })
const { verifyAuthorization } = require('../middleware/login.middleware')
const { verifyAdminOnly } = require('../middleware/permission.middleware')

const settingController = require('../controller/setting.controller')
// 添加轮播图
settingRouter.post(
	'/carousel',
	verifyAuthorization,
	verifyAdminOnly,
	settingController.create
)
// 删除轮播图
settingRouter.delete(
	'/carousel/:carousel_id',
	verifyAuthorization,
	verifyAdminOnly,
	settingController.remove
)
// 修改轮播图状态
settingRouter.put(
	'/carousel/:carousel_id/status',
	verifyAuthorization,
	verifyAdminOnly,
	settingController.updateStatus
)
// 查询轮播图
settingRouter.get('/carousel', settingController.getCarousels)

module.exports = settingRouter
